<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:Stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
<xsl:stylesheet         
        version="1.0"         
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"         
        xmlns:msxml="urn:schemas-microsoft-com:xslt"
        xmlns:umbraco.library="urn:umbraco.library"
         exclude-result-prefixes="msxml umbraco.library">
        <xsl:output method="xml" omit-xml-declaration="yes"/>
        <xsl:param name="currentPage"/>
        <xsl:template match="/">
                <xsl:choose>
                        <xsl:when test="starts-with(umbraco.library:RequestServerVariables('HTTP_HOST'),'www')">
                                <xsl:variable name="url" select="concat('http://',umbraco.library:RequestServerVariables('HTTP_HOST'))" />
                                <link rel="canonical" href="{$url}{umbraco.library:NiceUrl($currentPage/@id)}" />
                        </xsl:when>
                        <xsl:otherwise>
                                <xsl:variable name="url" select="concat('http://www.',umbraco.library:RequestServerVariables('HTTP_HOST'))" />
                                <link rel="canonical" href="{$url}{umbraco.library:NiceUrl($currentPage/@id)}" />
                        </xsl:otherwise>
                </xsl:choose>
        </xsl:template>
</xsl:stylesheet>